package cn.org.rookie.jeesdp.core.po;

import cn.org.rookie.jeesdp.core.BaseEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.List;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
public class User extends BaseEntity implements UserDetails {

    private String type;
    private String username;
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
    private String name;
    private String email;
    private String phone;
    /**
     * 账号非过期
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private boolean accountNonExpired = true;
    /**
     * 账号非锁定
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private boolean accountNonLocked = true;
    /**
     * 凭据未过期
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private boolean credentialsNonExpired = true;
    /**
     * 启用
     */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private boolean enabled = true;
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private List<Authority> authorities;

}
